package com.xmx.mapper;

import com.xmx.entity.CrmUsers;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ICrmUsersMapper {
    @Select("select * from crmUsers where username=#{username} and userpwd=#{userpwd}")
    CrmUsers queryUserBy(CrmUsers crmUsers);

    //根据userid查询用户
    @Select("select * from crmUsers where userid=#{id}")
    CrmUsers queryCrmUserById(Integer userid);
    //查询所有用户
    @Select("select * from crmUsers")
    List<CrmUsers> queryAllUsers();

    //添加新用户
    @Insert("insert into crmUsers values(null,#{username},#{userpwd},#{realname})")
    @Options(useGeneratedKeys = true,keyProperty = "userid")
    void addNewUser(CrmUsers users);
    //删除用户
    @Delete("delete from crmUsers where userid=#{uid}")
    void delteuserByid(Integer uid);

    //更新用户信息
    @Update("update crmUsers set username=#{username},realname=#{realname} where userid=#{userid}")
    void updateUser(CrmUsers crmUsers);



}
